# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary


class Recipe(recipe.Recipe):
    name = 'sqlite3'
    version = '3320300'
    stype = SourceType.TARBALL
    btype = BuildType.MESON
    url = 'https://sqlite.org/2020/sqlite-amalgamation-%(version)s.zip'
    tarball_dirname = 'sqlite-amalgamation-%(version)s'
    tarball_checksum = 'e9cec01d4519e2d49b3810615237325263fe1feaceae390ee12b4a29bd73dbe2'
    licenses = [License.PublicDomain]

    patches = [
        # https://github.com/mesonbuild/sqlite/pull/16
        'sqlite3/0001-Add-meson-build-file-from-wrapdb.patch',
    ]

    files_libs = ['libsqlite3']
    files_devel = ['include/sqlite3.h', 'lib/pkgconfig/sqlite3.pc']

    def post_install(self):
        libtool_la = LibtoolLibrary('sqlite3', 0, 0, 0, self.config.libdir,
                self.config.target_platform)
        libtool_la.save()
        super().post_install()
